package com.birdpiss.commons.domain;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * The Class Transaction.
 *
 * @author mark
 */
public class Transaction implements Serializable {

	private static final long serialVersionUID = 656988314282177757L;
	private Integer id;
	private Integer debitAccountId;
	private Integer creditAccountId;
	private BigDecimal amount;
	private TransactionStatus transactionStatus = TransactionStatus.PENDING;

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * Gets the debit account id.
	 *
	 * @return the debit account id
	 */
	public Integer getDebitAccountId() {
		return this.debitAccountId;
	}

	/**
	 * Sets the debit account id.
	 *
	 * @param debitAccountId the new debit account id
	 */
	public void setDebitAccountId(Integer debitAccountId) {
		this.debitAccountId = debitAccountId;
	}

	/**
	 * Gets the credit account id.
	 *
	 * @return the credit account id
	 */
	public Integer getCreditAccountId() {
		return this.creditAccountId;
	}

	/**
	 * Sets the credit account id.
	 *
	 * @param creditAccountId the new credit account id
	 */
	public void setCreditAccountId(Integer creditAccountId) {
		this.creditAccountId = creditAccountId;
	}

	/**
	 * Gets the amount.
	 *
	 * @return the amount
	 */
	public BigDecimal getAmount() {
		return this.amount;
	}

	/**
	 * Sets the amount.
	 *
	 * @param amount the new amount
	 */
	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	/**
	 * Gets the transaction status.
	 *
	 * @return the transaction status
	 */
	public TransactionStatus getTransactionStatus() {
		return this.transactionStatus;
	}

	/**
	 * Sets the transaction status.
	 *
	 * @param transactionStatus the new transaction status
	 */
	public void setTransactionStatus(TransactionStatus transactionStatus) {
		this.transactionStatus = transactionStatus;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("\nId: " + this.id);
		sb.append("\nCredit Account Id: " + this.creditAccountId);
		sb.append("\nDebit Account Id: " + this.debitAccountId);
		sb.append("\nAmount: $" + this.amount);
		sb.append("\nTransaction Status: " + TransactionStatus.toString(this.transactionStatus.value()));

		return sb.toString();
	}

}
